<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>页面布局</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        body {
            font-size: 14px;
        }

        #container {
            margin: 0 auto;
            /* width: 1000px; */
            width: 100%;
        }

        #header{
            height: 100px;
            background-color: bisque;
            margin-bottom: 5px; 

            position:sticky;
            top:0;
        }

        #main{
            /* height: 300px; */
            height: calc(100vh - 160px);
            background-color: aqua;
            margin-bottom: 5px;
        }
        #footer{
            height: 50px;
            background-color: bisque;
        }

        @media (max-width: 600px){
            #header{
                background-color: green;
            }
        }
    </style>
</head>

<body>
    <div id="container">
        <div id="header"></div>
        <div id="main"></div>
        <div id="footer"></div>
    </div>
</body>

</html>